<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Test::Deep - Extremely flexible deep comparison - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Test-Deep - MetaCPAN" href="https://metacpan.org/dist/Test-Deep/releases.rss" />
        <link rel="canonical" href="./Test::Deep.html" />
        <meta name="description" content="Extremely flexible deep comparison" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Test::Deep" />
<meta name="twitter:title"       content="Test::Deep" />
<meta name="twitter:description" content="Extremely flexible deep comparison" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Test::Deep.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Test-Deep was released.">
      <span class="relatize">07 Jan 2023 23:02:26 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Test-Deep">Test-Deep</a>
  </li>
  <li>
    Module version: 1.204
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Test-Deep/source/lib/Test/Deep.pm">Source</a>
    (<a href="https://metacpan.org/dist/Test-Deep/source/lib/Test/Deep.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Test-Deep/source/lib/Test">Browse</a>
    (<a href="https://metacpan.org/dist/Test-Deep/source/lib/Test?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Test-Deep/changes">Changes</a>
    </li>
    <li>
      <a rel="noopener nofollow" class="nopopup" href="https://github.com/rjbs/Test-Deep">Homepage</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Test-Deep/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/rjbs/Test-Deep">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://github.com/rjbs/Test-Deep/issues">Issues</a>
      (8)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Test-Deep+1.204" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Test-Deep.html?oncpan=1&amp;distmat=1&amp;version=1.204&amp;grade=2" style="color: #090">3316</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Test-Deep.html?oncpan=1&amp;distmat=1&amp;version=1.204&amp;grade=3" style="color: #900">0</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/Test-Deep.html?oncpan=1&amp;distmat=1&amp;version=1.204&amp;grade=4">10</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/RJBS/Test-Deep-1.204">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Test-Deep who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 1
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Test-Deep-1.204/index.html">86.58% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li>
      Perl: v5.12.0
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Test-Deep/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/R/RJ/RJBS/Test-Deep-1.204.tar.gz">
      Download (<span itemprop="fileSize">68.42KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FRJBS%2FTest-Deep-1.204%2Flib%2FTest%2FDeep.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Test-Deep/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Test-Deep/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Test-Deep">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Test-Deep">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Test/Deep.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="RJBS/Test-Deep-1.204"
>1.204
  (RJBS on 2023-01-07)</option>
<option
  
  value="RJBS/Test-Deep-1.203"
>1.203
  (RJBS on 2023-01-07)</option>
<option
  
  value="FDALY/Test-Deep-0.106"
>0.106
  (FDALY on 2009-08-10)</option>
<option
  
  value="FDALY/Test-Deep-0.105_02"
>0.105_02 DEV
  (FDALY on 2009-08-08)</option>
<option
  
  value="FDALY/Test-Deep-0.105_01"
>0.105_01 DEV
  (FDALY on 2009-08-07)</option>
<option
  
  value="FDALY/Test-Deep-0.104"
>0.104
  (FDALY on 2009-03-05)</option>
<option
  
  value="FDALY/Test-Deep-0.103"
>0.103
  (FDALY on 2008-06-03)</option>
<option
  
  value="FDALY/Test-Deep-0.102"
>0.102
  (FDALY on 2008-05-30)</option>
<option
  
  value="FDALY/Test-Deep-0.101"
>0.101
  (FDALY on 2008-05-13)</option>
<option
  
  value="FDALY/Test-Deep-0.100"
>0.100
  (FDALY on 2008-01-27)</option>
<option
  
  value="FDALY/Test-Deep-0.099"
>0.099
  (FDALY on 2007-10-28)</option>
<option
  
  value="FDALY/Test-Deep-0.098"
>0.098
  (FDALY on 2007-09-06)</option>
<option
  
  value="FDALY/Test-Deep-0.097"
>0.097
  (FDALY on 2007-08-05)</option>
<option
  
  value="FDALY/Test-Deep-0.096"
>0.096
  (FDALY on 2006-09-23)</option>
<optgroup label="BackPAN">'
<option
  
  value="RJBS/Test-Deep-1.202"
>1.202
  (RJBS on 2023-01-05)</option>
<option
  
  value="RJBS/Test-Deep-1.201-TRIAL"
>1.201-TRIAL DEV
  (RJBS on 2023-01-04)</option>
<option
  
  value="RJBS/Test-Deep-1.200-TRIAL"
>1.200-TRIAL DEV
  (RJBS on 2023-01-02)</option>
<option
  
  value="RJBS/Test-Deep-1.130"
>1.130
  (RJBS on 2020-03-01)</option>
<option
  
  value="RJBS/Test-Deep-1.129-TRIAL"
>1.129-TRIAL DEV
  (RJBS on 2020-01-26)</option>
<option
  
  value="RJBS/Test-Deep-1.128"
>1.128
  (RJBS on 2018-04-19)</option>
<option
  
  value="RJBS/Test-Deep-1.127"
>1.127
  (RJBS on 2017-05-04)</option>
<option
  
  value="RJBS/Test-Deep-1.126_001"
>1.126_001 DEV
  (RJBS on 2017-04-18)</option>
<option
  
  value="RJBS/Test-Deep-1.126"
>1.126
  (RJBS on 2017-01-01)</option>
<option
  
  value="RJBS/Test-Deep-1.125_001"
>1.125_001 DEV
  (RJBS on 2016-12-27)</option>
<option
  
  value="RJBS/Test-Deep-1.124"
>1.124
  (RJBS on 2016-11-06)</option>
<option
  
  value="RJBS/Test-Deep-1.123"
>1.123
  (RJBS on 2016-09-09)</option>
<option
  
  value="RJBS/Test-Deep-1.122"
>1.122
  (RJBS on 2016-09-08)</option>
<option
  
  value="RJBS/Test-Deep-1.121_001"
>1.121_001 DEV
  (RJBS on 2016-07-20)</option>
<option
  
  value="RJBS/Test-Deep-1.120"
>1.120
  (RJBS on 2015-11-28)</option>
<option
  
  value="RJBS/Test-Deep-0.119_01"
>0.119_01 DEV
  (RJBS on 2015-11-20)</option>
<option
  
  value="RJBS/Test-Deep-0.119"
>0.119
  (RJBS on 2015-09-29)</option>
<option
  
  value="RJBS/Test-Deep-0.117"
>0.117
  (RJBS on 2015-06-22)</option>
<option
  
  value="RJBS/Test-Deep-0.116"
>0.116
  (RJBS on 2015-06-20)</option>
<option
  
  value="RJBS/Test-Deep-0.115"
>0.115
  (RJBS on 2015-01-09)</option>
<option
  
  value="RJBS/Test-Deep-0.114"
>0.114
  (RJBS on 2014-12-12)</option>
<option
  
  value="RJBS/Test-Deep-0.113"
>0.113
  (RJBS on 2014-08-23)</option>
<option
  
  value="RJBS/Test-Deep-0.112"
>0.112
  (RJBS on 2013-11-30)</option>
<option
  
  value="RJBS/Test-Deep-0.111"
>0.111
  (RJBS on 2013-11-30)</option>
<option
  
  value="RJBS/Test-Deep-0.110"
>0.110
  (RJBS on 2012-06-16)</option>
<option
  
  value="RJBS/Test-Deep-0.109"
>0.109
  (RJBS on 2012-02-17)</option>
<option
  
  value="RJBS/Test-Deep-0.108"
>0.108
  (RJBS on 2010-10-16)</option>
<option
  
  value="RJBS/Test-Deep-0.107"
>0.107
  (RJBS on 2010-09-29)</option>
<option
  
  value="FDALY/Test-Deep-0.099_a1"
>0.099_a1
  (FDALY on 2007-10-27)</option>
<option
  
  value="FDALY/Test-Deep-0.095"
>0.095
  (FDALY on 2006-04-20)</option>
<option
  
  value="FDALY/Test-Deep-0.094"
>0.094
  (FDALY on 2006-04-09)</option>
<option
  
  value="FDALY/Test-Deep-0.093"
>0.093
  (FDALY on 2005-11-30)</option>
<option
  
  value="FDALY/Test-Deep-0.092"
>0.092
  (FDALY on 2005-10-26)</option>
<option
  
  value="FDALY/Test-Deep-0.091"
>0.091
  (FDALY on 2005-10-23)</option>
<option
  
  value="FDALY/Test-Deep-0.090"
>0.090
  (FDALY on 2005-10-23)</option>
<option
  
  value="FDALY/Test-Deep-0.089"
>0.089
  (FDALY on 2005-10-08)</option>
<option
  
  value="FDALY/Test-Deep-0.088"
>0.088
  (FDALY on 2005-07-19)</option>
<option
  
  value="FDALY/Test-Deep-0.087"
>0.087
  (FDALY on 2004-08-20)</option>
<option
  
  value="FDALY/Test-Deep-0.086"
>0.086
  (FDALY on 2004-08-08)</option>
<option
  
  value="FDALY/Test-Deep-0.085"
>0.085
  (FDALY on 2004-05-11)</option>
<option
  
  value="FDALY/Test-Deep-0.084"
>0.084
  (FDALY on 2004-03-23)</option>
<option
  
  value="FDALY/Test-Deep-0.082"
>0.082
  (FDALY on 2003-11-13)</option>
<option
  
  value="FDALY/Test-Deep-0.082_beta1"
>0.082_beta1
  (FDALY on 2003-11-10)</option>
<option
  
  value="FDALY/Test-Deep-0.081"
>0.081
  (FDALY on 2003-09-16)</option>
<option
  
  value="FDALY/Test-Deep-0.08"
>0.08
  (FDALY on 2003-09-02)</option>
<option
  
  value="FDALY/Test-Deep-0.07"
>0.07
  (FDALY on 2003-08-05)</option>
<option
  
  value="FDALY/Test-Deep-0.06"
>0.06
  (FDALY on 2003-07-12)</option>
<option
  
  value="FDALY/Test-Deep-0.05"
>0.05
  (FDALY on 2003-06-21)</option>
<option
  
  value="FDALY/Test-Deep-0.04"
>0.04
  (FDALY on 2003-06-18)</option>
<option
  
  value="FDALY/Test-Deep-0.03"
>0.03
  (FDALY on 2003-06-18)</option>
<option
  
  value="FDALY/Test-Deep-0.02"
>0.02
  (FDALY on 2003-03-19)</option>
<option
  
  value="FDALY/Test-Deep-0.01"
>0.01
  (FDALY on 2003-03-18)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/RJBS/Test-Deep-1.204/diff/' + encodeURIComponent(this.value) + '/lib/Test/Deep.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="RJBS/Test-Deep-1.204"
>1.204
  (RJBS on 2023-01-07)</option>
<option
  
  value="RJBS/Test-Deep-1.203"
>1.203
  (RJBS on 2023-01-07)</option>
<option
  
  value="FDALY/Test-Deep-0.106"
>0.106
  (FDALY on 2009-08-10)</option>
<option
  
  value="FDALY/Test-Deep-0.105_02"
>0.105_02 DEV
  (FDALY on 2009-08-08)</option>
<option
  
  value="FDALY/Test-Deep-0.105_01"
>0.105_01 DEV
  (FDALY on 2009-08-07)</option>
<option
  
  value="FDALY/Test-Deep-0.104"
>0.104
  (FDALY on 2009-03-05)</option>
<option
  
  value="FDALY/Test-Deep-0.103"
>0.103
  (FDALY on 2008-06-03)</option>
<option
  
  value="FDALY/Test-Deep-0.102"
>0.102
  (FDALY on 2008-05-30)</option>
<option
  
  value="FDALY/Test-Deep-0.101"
>0.101
  (FDALY on 2008-05-13)</option>
<option
  
  value="FDALY/Test-Deep-0.100"
>0.100
  (FDALY on 2008-01-27)</option>
<option
  
  value="FDALY/Test-Deep-0.099"
>0.099
  (FDALY on 2007-10-28)</option>
<option
  
  value="FDALY/Test-Deep-0.098"
>0.098
  (FDALY on 2007-09-06)</option>
<option
  
  value="FDALY/Test-Deep-0.097"
>0.097
  (FDALY on 2007-08-05)</option>
<option
  
  value="FDALY/Test-Deep-0.096"
>0.096
  (FDALY on 2006-09-23)</option>
<optgroup label="BackPAN">'
<option
  
  value="RJBS/Test-Deep-1.202"
>1.202
  (RJBS on 2023-01-05)</option>
<option
  
  value="RJBS/Test-Deep-1.201-TRIAL"
>1.201-TRIAL DEV
  (RJBS on 2023-01-04)</option>
<option
  
  value="RJBS/Test-Deep-1.200-TRIAL"
>1.200-TRIAL DEV
  (RJBS on 2023-01-02)</option>
<option
  
  value="RJBS/Test-Deep-1.130"
>1.130
  (RJBS on 2020-03-01)</option>
<option
  
  value="RJBS/Test-Deep-1.129-TRIAL"
>1.129-TRIAL DEV
  (RJBS on 2020-01-26)</option>
<option
  
  value="RJBS/Test-Deep-1.128"
>1.128
  (RJBS on 2018-04-19)</option>
<option
  
  value="RJBS/Test-Deep-1.127"
>1.127
  (RJBS on 2017-05-04)</option>
<option
  
  value="RJBS/Test-Deep-1.126_001"
>1.126_001 DEV
  (RJBS on 2017-04-18)</option>
<option
  
  value="RJBS/Test-Deep-1.126"
>1.126
  (RJBS on 2017-01-01)</option>
<option
  
  value="RJBS/Test-Deep-1.125_001"
>1.125_001 DEV
  (RJBS on 2016-12-27)</option>
<option
  
  value="RJBS/Test-Deep-1.124"
>1.124
  (RJBS on 2016-11-06)</option>
<option
  
  value="RJBS/Test-Deep-1.123"
>1.123
  (RJBS on 2016-09-09)</option>
<option
  
  value="RJBS/Test-Deep-1.122"
>1.122
  (RJBS on 2016-09-08)</option>
<option
  
  value="RJBS/Test-Deep-1.121_001"
>1.121_001 DEV
  (RJBS on 2016-07-20)</option>
<option
  
  value="RJBS/Test-Deep-1.120"
>1.120
  (RJBS on 2015-11-28)</option>
<option
  
  value="RJBS/Test-Deep-0.119_01"
>0.119_01 DEV
  (RJBS on 2015-11-20)</option>
<option
  
  value="RJBS/Test-Deep-0.119"
>0.119
  (RJBS on 2015-09-29)</option>
<option
  
  value="RJBS/Test-Deep-0.117"
>0.117
  (RJBS on 2015-06-22)</option>
<option
  
  value="RJBS/Test-Deep-0.116"
>0.116
  (RJBS on 2015-06-20)</option>
<option
  
  value="RJBS/Test-Deep-0.115"
>0.115
  (RJBS on 2015-01-09)</option>
<option
  
  value="RJBS/Test-Deep-0.114"
>0.114
  (RJBS on 2014-12-12)</option>
<option
  
  value="RJBS/Test-Deep-0.113"
>0.113
  (RJBS on 2014-08-23)</option>
<option
  
  value="RJBS/Test-Deep-0.112"
>0.112
  (RJBS on 2013-11-30)</option>
<option
  
  value="RJBS/Test-Deep-0.111"
>0.111
  (RJBS on 2013-11-30)</option>
<option
  
  value="RJBS/Test-Deep-0.110"
>0.110
  (RJBS on 2012-06-16)</option>
<option
  
  value="RJBS/Test-Deep-0.109"
>0.109
  (RJBS on 2012-02-17)</option>
<option
  
  value="RJBS/Test-Deep-0.108"
>0.108
  (RJBS on 2010-10-16)</option>
<option
  
  value="RJBS/Test-Deep-0.107"
>0.107
  (RJBS on 2010-09-29)</option>
<option
  
  value="FDALY/Test-Deep-0.099_a1"
>0.099_a1
  (FDALY on 2007-10-27)</option>
<option
  
  value="FDALY/Test-Deep-0.095"
>0.095
  (FDALY on 2006-04-20)</option>
<option
  
  value="FDALY/Test-Deep-0.094"
>0.094
  (FDALY on 2006-04-09)</option>
<option
  
  value="FDALY/Test-Deep-0.093"
>0.093
  (FDALY on 2005-11-30)</option>
<option
  
  value="FDALY/Test-Deep-0.092"
>0.092
  (FDALY on 2005-10-26)</option>
<option
  
  value="FDALY/Test-Deep-0.091"
>0.091
  (FDALY on 2005-10-23)</option>
<option
  
  value="FDALY/Test-Deep-0.090"
>0.090
  (FDALY on 2005-10-23)</option>
<option
  
  value="FDALY/Test-Deep-0.089"
>0.089
  (FDALY on 2005-10-08)</option>
<option
  
  value="FDALY/Test-Deep-0.088"
>0.088
  (FDALY on 2005-07-19)</option>
<option
  
  value="FDALY/Test-Deep-0.087"
>0.087
  (FDALY on 2004-08-20)</option>
<option
  
  value="FDALY/Test-Deep-0.086"
>0.086
  (FDALY on 2004-08-08)</option>
<option
  
  value="FDALY/Test-Deep-0.085"
>0.085
  (FDALY on 2004-05-11)</option>
<option
  
  value="FDALY/Test-Deep-0.084"
>0.084
  (FDALY on 2004-03-23)</option>
<option
  
  value="FDALY/Test-Deep-0.082"
>0.082
  (FDALY on 2003-11-13)</option>
<option
  
  value="FDALY/Test-Deep-0.082_beta1"
>0.082_beta1
  (FDALY on 2003-11-10)</option>
<option
  
  value="FDALY/Test-Deep-0.081"
>0.081
  (FDALY on 2003-09-16)</option>
<option
  
  value="FDALY/Test-Deep-0.08"
>0.08
  (FDALY on 2003-09-02)</option>
<option
  
  value="FDALY/Test-Deep-0.07"
>0.07
  (FDALY on 2003-08-05)</option>
<option
  
  value="FDALY/Test-Deep-0.06"
>0.06
  (FDALY on 2003-07-12)</option>
<option
  
  value="FDALY/Test-Deep-0.05"
>0.05
  (FDALY on 2003-06-21)</option>
<option
  
  value="FDALY/Test-Deep-0.04"
>0.04
  (FDALY on 2003-06-18)</option>
<option
  
  value="FDALY/Test-Deep-0.03"
>0.03
  (FDALY on 2003-06-18)</option>
<option
  
  value="FDALY/Test-Deep-0.02"
>0.02
  (FDALY on 2003-03-19)</option>
<option
  
  value="FDALY/Test-Deep-0.01"
>0.01
  (FDALY on 2003-03-18)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/List::Util" title="List::Util" class="ellipsis">List::Util</a></li>
  <li><a href="https://metacpan.org/pod/Scalar::Util" title="Scalar::Util" class="ellipsis">Scalar::Util</a></li>
  <li><a href="https://metacpan.org/pod/Test::Builder" title="Test::Builder" class="ellipsis">Test::Builder</a></li>
  <li><a href="https://metacpan.org/pod/Test::More" title="Test::More" class="ellipsis">Test::More</a></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Test::Deep/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Test%3A%3ADeep">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Test-Deep">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/RJBS/Test-Deep-1.204/view/lib/Test/Deep.pm">This version</a>
    </li>
    <li>
      <a href="./Test::Deep.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/ETHER"><img src="https://www.gravatar.com/avatar/bdc5cd06679e732e262f6c1b450a0237?d=identicon&amp;s=20" title="ETHER" alt="ETHER"></a>
<a class="display-all" href="https://metacpan.org/author/KABLAMO"><img src="https://www.gravatar.com/avatar/6c59a99ff976dc69fe31f1fe3bf6dc01?d=identicon&amp;s=20" title="KABLAMO" alt="KABLAMO"></a>
<a class="display-all" href="https://metacpan.org/author/DAGOLDEN"><img src="https://www.gravatar.com/avatar/bb755c989fcb9897f28a2c6e00df61e2?d=identicon&amp;s=20" title="DAGOLDEN" alt="DAGOLDEN"></a>
<a class="display-all" href="https://metacpan.org/author/DBOEHMER"><img src="https://www.gravatar.com/avatar/220fbe10dba79664fe84771d5ea32763?d=identicon&amp;s=20" title="DBOEHMER" alt="DBOEHMER"></a>
<a class="display-all" href="https://metacpan.org/author/MELO"><img src="https://www.gravatar.com/avatar/4809188f41ad2613f4c240b72d97604c?d=identicon&amp;s=20" title="MELO" alt="MELO"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Test-Deep/plussers">30 PAUSE users</a>
</div>
<div>
    24 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 23 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
      data-contrib-email="fergal@esatclear.ie"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Fergal Daly
    </li>
    <li class="contributor"
      data-contrib-email="karjala@karjala.org"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Alexander Karelas
    </li>
    <li class="contributor"
      data-contrib-email="blyman@shutterstock.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Belden Lyman
    </li>
    <li class="contributor"
      data-cpan-author="DBOEHMER"
      data-contrib-email="dboehmer@cpan.org"
    >
      <a href="https://metacpan.org/author/DBOEHMER" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/220fbe10dba79664fe84771d5ea32763?d=identicon&amp;s=20" />
      Daniel Böhmer
      </a>
    </li>
    <li class="contributor"
      data-contrib-email="dsteinbrunner@pobox.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      David Steinbrunner
    </li>
    <li class="contributor"
      data-contrib-email="dionys@gmail.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Denis Ibaev
    </li>
    <li class="contributor"
      data-cpan-author="EDMUND"
      data-contrib-email="edmund@cpan.org"
    >
      <a href="https://metacpan.org/author/EDMUND" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/fd985fb2ce319f864496f871c39e0eb8?d=identicon&amp;s=20" />
      Ed Adjei
      </a>
    </li>
    <li class="contributor"
      data-cpan-author="FGA"
      data-contrib-email="fabrice.gabolde@gmail.com"
    >
      <a href="https://metacpan.org/author/FGA" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/a1a232556694ed753ac491703b7df184?d=identicon&amp;s=20" />
      Fabrice Gabolde
      </a>
    </li>
    <li class="contributor"
      data-contrib-email="felipe@felipegasper.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Felipe Gasper
    </li>
    <li class="contributor"
      data-contrib-email="hartzell@alerce.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      George Hartzell
    </li>
    <li class="contributor"
      data-cpan-author="HAARG"
      data-contrib-email="haarg@haarg.org"
    >
      <a href="https://metacpan.org/author/HAARG" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/5037faf9ba40cf736778820fe83fc2ae?d=identicon&amp;s=20" />
      Graham Knop
      </a>
    </li>
    <li class="contributor"
      data-cpan-author="BESSARABV"
      data-contrib-email="ivan@bessarabov.ru"
    >
      <a href="https://metacpan.org/author/BESSARABV" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/f848f8b82e51b7a88ca22562639a814b?d=identicon&amp;s=20" />
      Ivan Bessarabov
      </a>
    </li>
    <li class="contributor"
      data-cpan-author="JJATRIA"
      data-contrib-email="jjatria@cpan.org"
    >
      <a href="https://metacpan.org/author/JJATRIA" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/c796997d2231a41e24f485e4726ea810?d=identicon&amp;s=20" />
      José Joaquín Atria
      </a>
    </li>
    <li class="contributor"
      data-cpan-author="ETHER"
      data-contrib-email="ether@cpan.org"
    >
      <a href="https://metacpan.org/author/ETHER" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/bdc5cd06679e732e262f6c1b450a0237?d=identicon&amp;s=20" />
      Karen Etheridge
      </a>
    </li>
    <li class="contributor"
      data-contrib-email="kentfredric@gmail.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Kent Fredric
    </li>
    <li class="contributor"
      data-cpan-author="LANCEW"
      data-contrib-email="lancew@cpan.org"
    >
      <a href="https://metacpan.org/author/LANCEW" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/b4a5eb5daadce1b8727a267211f0b49a?d=identicon&amp;s=20" />
      Lance Wicks
      </a>
    </li>
    <li class="contributor"
      data-contrib-email="wolfsage@gmail.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Matthew Horsfall
    </li>
    <li class="contributor"
      data-contrib-email="myrrhlin@gmail.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Michael Hamlin
    </li>
    <li class="contributor"
      data-cpan-author="MANWAR"
      data-contrib-email="mohammad.anwar@yahoo.com"
    >
      <a href="https://metacpan.org/author/MANWAR" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/71c853edf567f3482e0e7f21d51e9df2?d=identicon&amp;s=20" />
      Mohammad S Anwar
      </a>
    </li>
    <li class="contributor"
      data-contrib-email="peter.haworth@headforwards.com"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Peter Haworth
    </li>
    <li class="contributor"
      data-contrib-email="p.ludlam@cv-library.co.uk"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Philip J. Ludlam
    </li>
    <li class="contributor"
      data-contrib-email="rjbs@semiotic.systems"
    >
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?d=identicon&amp;s=20" />
      Ricardo Signes
    </li>
    <li class="contributor"
      data-cpan-author="ZOFFIX"
      data-contrib-email="cpan@zoffix.com"
    >
      <a href="https://metacpan.org/author/ZOFFIX" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/627d83ef9879f31bdabf448e666a32d5?d=identicon&amp;s=20" />
      Zoffix Znet
      </a>
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/RJBS" class="author-name">Ricardo SIGNES 😄</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Test/Deep.pm&#39;" class="">
<option
  selected
  value="RJBS/Test-Deep-1.204"
>1.204
  (RJBS on 2023-01-07)</option>
<option
  
  value="RJBS/Test-Deep-1.203"
>1.203
  (RJBS on 2023-01-07)</option>
<option
  
  value="FDALY/Test-Deep-0.106"
>0.106
  (FDALY on 2009-08-10)</option>
<option
  
  value="FDALY/Test-Deep-0.105_02"
>0.105_02 DEV
  (FDALY on 2009-08-08)</option>
<option
  
  value="FDALY/Test-Deep-0.105_01"
>0.105_01 DEV
  (FDALY on 2009-08-07)</option>
<option
  
  value="FDALY/Test-Deep-0.104"
>0.104
  (FDALY on 2009-03-05)</option>
<option
  
  value="FDALY/Test-Deep-0.103"
>0.103
  (FDALY on 2008-06-03)</option>
<option
  
  value="FDALY/Test-Deep-0.102"
>0.102
  (FDALY on 2008-05-30)</option>
<option
  
  value="FDALY/Test-Deep-0.101"
>0.101
  (FDALY on 2008-05-13)</option>
<option
  
  value="FDALY/Test-Deep-0.100"
>0.100
  (FDALY on 2008-01-27)</option>
<option
  
  value="FDALY/Test-Deep-0.099"
>0.099
  (FDALY on 2007-10-28)</option>
<option
  
  value="FDALY/Test-Deep-0.098"
>0.098
  (FDALY on 2007-09-06)</option>
<option
  
  value="FDALY/Test-Deep-0.097"
>0.097
  (FDALY on 2007-08-05)</option>
<option
  
  value="FDALY/Test-Deep-0.096"
>0.096
  (FDALY on 2006-09-23)</option>
<optgroup label="BackPAN">'
<option
  
  value="RJBS/Test-Deep-1.202"
>1.202
  (RJBS on 2023-01-05)</option>
<option
  
  value="RJBS/Test-Deep-1.201-TRIAL"
>1.201-TRIAL DEV
  (RJBS on 2023-01-04)</option>
<option
  
  value="RJBS/Test-Deep-1.200-TRIAL"
>1.200-TRIAL DEV
  (RJBS on 2023-01-02)</option>
<option
  
  value="RJBS/Test-Deep-1.130"
>1.130
  (RJBS on 2020-03-01)</option>
<option
  
  value="RJBS/Test-Deep-1.129-TRIAL"
>1.129-TRIAL DEV
  (RJBS on 2020-01-26)</option>
<option
  
  value="RJBS/Test-Deep-1.128"
>1.128
  (RJBS on 2018-04-19)</option>
<option
  
  value="RJBS/Test-Deep-1.127"
>1.127
  (RJBS on 2017-05-04)</option>
<option
  
  value="RJBS/Test-Deep-1.126_001"
>1.126_001 DEV
  (RJBS on 2017-04-18)</option>
<option
  
  value="RJBS/Test-Deep-1.126"
>1.126
  (RJBS on 2017-01-01)</option>
<option
  
  value="RJBS/Test-Deep-1.125_001"
>1.125_001 DEV
  (RJBS on 2016-12-27)</option>
<option
  
  value="RJBS/Test-Deep-1.124"
>1.124
  (RJBS on 2016-11-06)</option>
<option
  
  value="RJBS/Test-Deep-1.123"
>1.123
  (RJBS on 2016-09-09)</option>
<option
  
  value="RJBS/Test-Deep-1.122"
>1.122
  (RJBS on 2016-09-08)</option>
<option
  
  value="RJBS/Test-Deep-1.121_001"
>1.121_001 DEV
  (RJBS on 2016-07-20)</option>
<option
  
  value="RJBS/Test-Deep-1.120"
>1.120
  (RJBS on 2015-11-28)</option>
<option
  
  value="RJBS/Test-Deep-0.119_01"
>0.119_01 DEV
  (RJBS on 2015-11-20)</option>
<option
  
  value="RJBS/Test-Deep-0.119"
>0.119
  (RJBS on 2015-09-29)</option>
<option
  
  value="RJBS/Test-Deep-0.117"
>0.117
  (RJBS on 2015-06-22)</option>
<option
  
  value="RJBS/Test-Deep-0.116"
>0.116
  (RJBS on 2015-06-20)</option>
<option
  
  value="RJBS/Test-Deep-0.115"
>0.115
  (RJBS on 2015-01-09)</option>
<option
  
  value="RJBS/Test-Deep-0.114"
>0.114
  (RJBS on 2014-12-12)</option>
<option
  
  value="RJBS/Test-Deep-0.113"
>0.113
  (RJBS on 2014-08-23)</option>
<option
  
  value="RJBS/Test-Deep-0.112"
>0.112
  (RJBS on 2013-11-30)</option>
<option
  
  value="RJBS/Test-Deep-0.111"
>0.111
  (RJBS on 2013-11-30)</option>
<option
  
  value="RJBS/Test-Deep-0.110"
>0.110
  (RJBS on 2012-06-16)</option>
<option
  
  value="RJBS/Test-Deep-0.109"
>0.109
  (RJBS on 2012-02-17)</option>
<option
  
  value="RJBS/Test-Deep-0.108"
>0.108
  (RJBS on 2010-10-16)</option>
<option
  
  value="RJBS/Test-Deep-0.107"
>0.107
  (RJBS on 2010-09-29)</option>
<option
  
  value="FDALY/Test-Deep-0.099_a1"
>0.099_a1
  (FDALY on 2007-10-27)</option>
<option
  
  value="FDALY/Test-Deep-0.095"
>0.095
  (FDALY on 2006-04-20)</option>
<option
  
  value="FDALY/Test-Deep-0.094"
>0.094
  (FDALY on 2006-04-09)</option>
<option
  
  value="FDALY/Test-Deep-0.093"
>0.093
  (FDALY on 2005-11-30)</option>
<option
  
  value="FDALY/Test-Deep-0.092"
>0.092
  (FDALY on 2005-10-26)</option>
<option
  
  value="FDALY/Test-Deep-0.091"
>0.091
  (FDALY on 2005-10-23)</option>
<option
  
  value="FDALY/Test-Deep-0.090"
>0.090
  (FDALY on 2005-10-23)</option>
<option
  
  value="FDALY/Test-Deep-0.089"
>0.089
  (FDALY on 2005-10-08)</option>
<option
  
  value="FDALY/Test-Deep-0.088"
>0.088
  (FDALY on 2005-07-19)</option>
<option
  
  value="FDALY/Test-Deep-0.087"
>0.087
  (FDALY on 2004-08-20)</option>
<option
  
  value="FDALY/Test-Deep-0.086"
>0.086
  (FDALY on 2004-08-08)</option>
<option
  
  value="FDALY/Test-Deep-0.085"
>0.085
  (FDALY on 2004-05-11)</option>
<option
  
  value="FDALY/Test-Deep-0.084"
>0.084
  (FDALY on 2004-03-23)</option>
<option
  
  value="FDALY/Test-Deep-0.082"
>0.082
  (FDALY on 2003-11-13)</option>
<option
  
  value="FDALY/Test-Deep-0.082_beta1"
>0.082_beta1
  (FDALY on 2003-11-10)</option>
<option
  
  value="FDALY/Test-Deep-0.081"
>0.081
  (FDALY on 2003-09-16)</option>
<option
  
  value="FDALY/Test-Deep-0.08"
>0.08
  (FDALY on 2003-09-02)</option>
<option
  
  value="FDALY/Test-Deep-0.07"
>0.07
  (FDALY on 2003-08-05)</option>
<option
  
  value="FDALY/Test-Deep-0.06"
>0.06
  (FDALY on 2003-07-12)</option>
<option
  
  value="FDALY/Test-Deep-0.05"
>0.05
  (FDALY on 2003-06-21)</option>
<option
  
  value="FDALY/Test-Deep-0.04"
>0.04
  (FDALY on 2003-06-18)</option>
<option
  
  value="FDALY/Test-Deep-0.03"
>0.03
  (FDALY on 2003-06-18)</option>
<option
  
  value="FDALY/Test-Deep-0.02"
>0.02
  (FDALY on 2003-03-19)</option>
<option
  
  value="FDALY/Test-Deep-0.01"
>0.01
  (FDALY on 2003-03-18)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Test-Deep">Test-Deep-1.204</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage five &#10;
          • 943 direct dependents &#10;          • 13145 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="15"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="20"  y="0" width="4" height="15" fill="#7ea3f2" />
    </g>
  </svg>

</span>
<div id="Test-Deep-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Test-Deep-1.204">
    <input type="hidden" name="author" value="RJBS">
    <input type="hidden" name="distribution" value="Test-Deep">
    <button type="submit" class="favorite highlight"><span>54</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Test::Deep.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>54</span> ++</a>
</div>
   / <span>Test::Deep</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Test::Deep.html#NAME">NAME</a></li>
  <li><a href="./Test::Deep.html#VERSION">VERSION</a></li>
  <li><a href="./Test::Deep.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Test::Deep.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./Test::Deep.html#PERL-VERSION">PERL VERSION</a></li>
  <li><a href="./Test::Deep.html#EXAMPLES">EXAMPLES</a>
    <ul>
      <li><a href="./Test::Deep.html#Without-Test::Deep">Without Test::Deep</a></li>
      <li><a href="./Test::Deep.html#With-Test::Deep">With Test::Deep</a></li>
      <li><a href="./Test::Deep.html#Reusing-structures">Reusing structures</a></li>
      <li><a href="./Test::Deep.html#Circular-data-structures">Circular data structures</a></li>
    </ul>
  </li>
  <li><a href="./Test::Deep.html#TERMINOLOGY">TERMINOLOGY</a></li>
  <li><a href="./Test::Deep.html#COMPARISON-FUNCTIONS">COMPARISON FUNCTIONS</a>
    <ul>
      <li>
        <ul>
          <li><a href="./Test::Deep.html#cmp_deeply">cmp_deeply</a></li>
          <li><a href="./Test::Deep.html#cmp_bag">cmp_bag</a></li>
          <li><a href="./Test::Deep.html#cmp_set">cmp_set</a></li>
          <li><a href="./Test::Deep.html#cmp_methods">cmp_methods</a></li>
          <li><a href="./Test::Deep.html#eq_deeply">eq_deeply</a></li>
          <li><a href="./Test::Deep.html#cmp_details">cmp_details</a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><a href="./Test::Deep.html#SPECIAL-COMPARISONS-PROVIDED">SPECIAL COMPARISONS PROVIDED</a>
    <ul>
      <li>
        <ul>
          <li><a href="./Test::Deep.html#ignore">ignore</a></li>
          <li><a href="./Test::Deep.html#methods">methods</a></li>
          <li><a href="./Test::Deep.html#listmethods">listmethods</a></li>
          <li><a href="./Test::Deep.html#shallow">shallow</a></li>
          <li><a href="./Test::Deep.html#noclass">noclass</a></li>
          <li><a href="./Test::Deep.html#useclass">useclass</a></li>
          <li><a href="./Test::Deep.html#re">re</a></li>
          <li><a href="./Test::Deep.html#all">all</a></li>
          <li><a href="./Test::Deep.html#any">any</a></li>
          <li><a href="./Test::Deep.html#Isa">Isa</a></li>
          <li><a href="./Test::Deep.html#isa">isa</a></li>
          <li><a href="./Test::Deep.html#obj_isa">obj_isa</a></li>
          <li><a href="./Test::Deep.html#array_each">array_each</a></li>
          <li><a href="./Test::Deep.html#hash_each">hash_each</a></li>
          <li><a href="./Test::Deep.html#str">str</a></li>
          <li><a href="./Test::Deep.html#num">num</a></li>
          <li><a href="./Test::Deep.html#bool,-true,-false">bool, true, false</a></li>
          <li><a href="./Test::Deep.html#code">code</a></li>
        </ul>
      </li>
      <li><a href="./Test::Deep.html#SET-COMPARISONS">SET COMPARISONS</a>
        <ul>
          <li><a href="./Test::Deep.html#set">set</a></li>
          <li><a href="./Test::Deep.html#supersetof">supersetof</a></li>
          <li><a href="./Test::Deep.html#subsetof">subsetof</a></li>
          <li><a href="./Test::Deep.html#none">none</a></li>
          <li><a href="./Test::Deep.html#noneof">noneof</a></li>
        </ul>
      </li>
      <li><a href="./Test::Deep.html#BAG-COMPARISONS">BAG COMPARISONS</a>
        <ul>
          <li><a href="./Test::Deep.html#bag">bag</a></li>
          <li><a href="./Test::Deep.html#superbagof">superbagof</a></li>
          <li><a href="./Test::Deep.html#subbagof">subbagof</a></li>
        </ul>
      </li>
      <li><a href="./Test::Deep.html#HASH-COMPARISONS">HASH COMPARISONS</a>
        <ul>
          <li><a href="./Test::Deep.html#superhashof">superhashof</a></li>
          <li><a href="./Test::Deep.html#subhashof">subhashof</a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><a href="./Test::Deep.html#DIAGNOSTIC-FUNCTIONS">DIAGNOSTIC FUNCTIONS</a>
    <ul>
      <li>
        <ul>
          <li><a href="./Test::Deep.html#deep_diag">deep_diag</a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><a href="./Test::Deep.html#ANOTHER-EXAMPLE">ANOTHER EXAMPLE</a></li>
  <li><a href="./Test::Deep.html#USING-TEST::DEEP-WITH-TEST::BUILDER">USING TEST::DEEP WITH TEST::BUILDER</a></li>
  <li><a href="./Test::Deep.html#LIMITATIONS">LIMITATIONS</a></li>
  <li><a href="./Test::Deep.html#BUGS">BUGS</a></li>
  <li><a href="./Test::Deep.html#CAVEATS">CAVEATS</a>
    <ul>
      <li><a href="./Test::Deep.html#SPECIAL-CARE-WITH-SPECIAL-COMPARISONS-IN-SETS-AND-BAGS">SPECIAL CARE WITH SPECIAL COMPARISONS IN SETS AND BAGS</a></li>
    </ul>
  </li>
  <li><a href="./Test::Deep.html#WHAT-ARE-SPECIAL-COMPARISONS?">WHAT ARE SPECIAL COMPARISONS?</a></li>
  <li><a href="./Test::Deep.html#EXPORTS">EXPORTS</a></li>
  <li><a href="./Test::Deep.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./Test::Deep.html#THANKS">THANKS</a></li>
  <li><a href="./Test::Deep.html#AUTHORS">AUTHORS</a></li>
  <li><a href="./Test::Deep.html#CONTRIBUTORS">CONTRIBUTORS</a></li>
  <li><a href="./Test::Deep.html#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Test::Deep - Extremely flexible deep comparison</p>

<h1 id="VERSION">VERSION</h1>

<p>version 1.204</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>  use Test::More tests =&gt; $Num_Tests;
  use Test::Deep;

  cmp_deeply(
    $actual_horrible_nested_data_structure,
    $expected_horrible_nested_data_structure,
    &quot;got the right horrible nested data structure&quot;
  );

  cmp_deeply(
    $object,
    methods(name =&gt; &quot;John&quot;, phone =&gt; &quot;55378008&quot;),
    &quot;object methods ok&quot;
  );

  cmp_deeply(
    \@array,
    [$hash1, $hash2, ignore()],
    &quot;first 2 elements are as expected, ignoring 3&quot;
  );

  cmp_deeply(
    $object,
    noclass({value =&gt; 5}),
    &quot;object looks ok, not checking its class&quot;
  );

  cmp_deeply(
    \@result,
    bag(&#39;a&#39;, &#39;b&#39;, {key =&gt; [1, 2]}),
    &quot;array has the 3 things we wanted in some order&quot;
  );</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>If you don&#39;t know anything about automated testing in Perl then you should probably read about <a href="https://metacpan.org/pod/Test::Simple">Test::Simple</a> and <a href="https://metacpan.org/pod/Test::More">Test::More</a> before preceding. Test::Deep uses the <a href="https://metacpan.org/pod/Test::Builder">Test::Builder</a> framework.</p>

<p>Test::Deep gives you very flexible ways to check that the result you got is the result you were expecting. At its simplest it compares two structures by going through each level, ensuring that the values match, that arrays and hashes have the same elements and that references are blessed into the correct class. It also handles circular data structures without getting caught in an infinite loop.</p>

<p>Where it becomes more interesting is in allowing you to do something besides simple exact comparisons. With strings, the <code>eq</code> operator checks that 2 strings are exactly equal but sometimes that&#39;s not what you want. When you don&#39;t know exactly what the string should be but you do know some things about how it should look, <code>eq</code> is no good and you must use pattern matching instead. Test::Deep provides pattern matching for complex data structures</p>

<p>Test::Deep has <b><i>a lot</i></b> of exports. See <a href="./Test::Deep.html#EXPORTS">&quot;EXPORTS&quot;</a> below.</p>

<h1 id="PERL-VERSION"><a id="PERL"></a>PERL VERSION</h1>

<p>This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years.</p>

<p>Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.</p>

<h1 id="EXAMPLES">EXAMPLES</h1>

<p>How Test::Deep works is much easier to understand by seeing some examples.</p>

<h2 id="Without-Test::Deep"><a id="Without"></a>Without Test::Deep</h2>

<p>Say you want to test a function which returns a string. You know that your string should be a 7 digit number beginning with 0, <code>eq</code> is no good in this situation, you need a regular expression. So you could use Test::More&#39;s <code>like()</code> function:</p>

<pre><code>  like($string, qr/^0[0-9]{6}$/, &quot;number looks good&quot;);</code></pre>

<p>Similarly, to check that a string looks like a name, you could do:</p>

<pre><code>  like($string, qr/^(Mr|Mrs|Miss) \w+ \w+$/,
    &quot;got title, first and last name&quot;);</code></pre>

<p>Now imagine your function produces a hash with some personal details in it. You want to make sure that there are 2 keys, Name and Phone and that the name looks like a name and the phone number looks like a phone number. You could do:</p>

<pre><code>  $hash = make_person();
  like($hash-&gt;{Name}, qr/^(Mr|Mrs|Miss) \w+ \w+$/, &quot;name ok&quot;);
  like($hash-&gt;{Phone}, qr/^0[0-9]{6}$/, &quot;phone ok&quot;);
  is(scalar keys %$hash, 2, &quot;correct number of keys&quot;);</code></pre>

<p>But that&#39;s not quite right, what if make_person has a serious problem and didn&#39;t even return a hash? We really need to write</p>

<pre><code>  if (ref($hash) eq &quot;HASH&quot;)
  {
    like($hash-&gt;{Name}, qr/^(Mr|Mrs|Miss) \w+ \w+$/, &quot;name ok&quot;);
    like($hash-&gt;{Phone}, qr/^0[0-9]{6}$/, &quot;phone ok&quot;);
    is(scalar keys %$hash, 2, &quot;correct number of keys&quot;);
  }
  else
  {
    fail(&quot;person not a hash&quot;);
    fail(&quot;person not a hash&quot;);
    fail(&quot;person not a hash&quot;); # need 3 to keep the plan correct
  }</code></pre>

<p>Already this is getting messy, now imagine another entry in the hash, an array of children&#39;s names. This would require</p>

<pre><code>  if (ref($hash) eq &quot;HASH&quot;)
  {
    like($hash-&gt;{Name}, $name_pat, &quot;name ok&quot;);
    like($hash-&gt;{Phone}, &#39;/^0d{6}$/&#39;, &quot;phone ok&quot;);
    my $cn = $hash-&gt;{ChildNames};
    if (ref($cn) eq &quot;ARRAY&quot;)
    {
      foreach my $child (@$cn)
      {
        like($child, $name_pat);
      }
    }
    else
    {
        fail(&quot;child names not an array&quot;)
    }
  }
  else
  {
    fail(&quot;person not a hash&quot;);
  }</code></pre>

<p>This is a horrible mess and because we don&#39;t know in advance how many children&#39;s names there will be, we can&#39;t make a plan for our test anymore (actually, we could but it would make things even more complicated).</p>

<p>Test::Deep to the rescue.</p>

<h2 id="With-Test::Deep"><a id="With"></a>With Test::Deep</h2>

<pre><code>  my $name_re = re(&#39;^(Mr|Mrs|Miss) \w+ \w+$&#39;);
  cmp_deeply(
    $person,
    {
      Name =&gt; $name_re,
      Phone =&gt; re(&#39;^0d{6}$&#39;),
      ChildNames =&gt; array_each($name_re)
    },
    &quot;person ok&quot;
  );</code></pre>

<p>This will do everything that the messy code above does and it will give a sensible message telling you exactly what went wrong if it finds a part of $person that doesn&#39;t match the pattern. <code>re()</code> and <code>array_each()</code> are special function imported from Test::Deep. They create a marker that tells Test::Deep that something different is happening here. Instead of just doing a simple comparison and checking are two things exactly equal, it should do something else.</p>

<p>If a person was asked to check that 2 structures are equal, they could print them both out and compare them line by line. The markers above are similar to writing a note in red pen on one of the printouts telling the person that for this piece of the structure, they should stop doing simple line by line comparison and do something else.</p>

<p><code>re($regex)</code> means that Test::Deep should check that the current piece of data matches the regex in <code>$regex</code>. <code>array_each($struct)</code> means that Test::Deep should expect the current piece of data to be an array and it should check that every element of that array matches <code>$struct</code>. In this case, every element of <code>$person-&gt;{ChildNames}</code> should look like a name. If say the 3rd one didn&#39;t you would get an error message something like</p>

<pre><code>  Using Regexp on $data-&gt;{ChildNames}[3]
     got    : &#39;Queen John Paul Sartre&#39;
     expect : /^(Mr|Mrs|Miss) \w+ \w+$/</code></pre>

<p>There are lots of other special comparisons available, see <a href="./Test::Deep.html#SPECIAL-COMPARISONS-PROVIDED">&quot;SPECIAL COMPARISONS PROVIDED&quot;</a> below for the full list.</p>

<h2 id="Reusing-structures"><a id="Reusing"></a>Reusing structures</h2>

<p>Test::Deep is good for reusing test structures so you can do this</p>

<pre><code>  my $name_re = re(&#39;^(Mr|Mrs|Miss) \w+ \w+$&#39;);
  my $person_cmp = {
    Name =&gt; $name_re,
    Phone =&gt; re(&#39;^0d{6}$&#39;),
    ChildNames =&gt; array_each($name_re)
  };

  cmp_deeply($person1, $person_cmp, &quot;person ok&quot;);
  cmp_deeply($person2, $person_cmp, &quot;person ok&quot;);
  cmp_deeply($person3, $person_cmp, &quot;person ok&quot;);</code></pre>

<p>You can even put $person_cmp in a module and let other people use it when they are writing test scripts for modules that use your modules.</p>

<p>To make things a little more difficult, lets change the person data structure so that instead of a list of ChildNames, it contains a list of hashes, one for each child. So in fact our person structure will contain other person structures which may contain other person structures and so on. This is easy to handle with Test::Deep because Test::Deep structures can include themselves. Simply do</p>

<pre><code>  my $name_re = re(&#39;^(Mr|Mrs|Miss) \w+ \w+$&#39;);
  my $person_cmp = {
    Name =&gt; $name_re,
    Phone =&gt; re(&#39;^0d{6}$&#39;),
    # note no mention of Children here
  };

  $person_cmp-&gt;{Children} = array_each($person_cmp);

  cmp_deeply($person, $person_cmp, &quot;person ok&quot;);</code></pre>

<p>This will now check that $person-&gt;{Children} is an array and that every element of that array also matches <code>$person_cmp</code>, this includes checking that its children also match the same pattern and so on.</p>

<h2 id="Circular-data-structures"><a id="Circular"></a>Circular data structures</h2>

<p>A circular data structure is one which loops back on itself, you can make one easily by doing</p>

<pre><code>  my @b;
  my @a = (1, 2, 3, \@b);
  push(@b, \@a);</code></pre>

<p>now <code>@a</code> contains a reference to be <code>@b</code> and <code>@b</code> contains a reference to <code>@a</code>. This causes problems if you have a program that wants to look inside <code>@a</code> and keep looking deeper and deeper at every level, it could get caught in an infinite loop looking into <code>@a</code> then <code>@b</code> then <code>@a</code> then <code>@b</code> and so on.</p>

<p>Test::Deep avoids this problem so we can extend our example further by saying that a person should also list their parents.</p>

<pre><code>  my $name_re = re(&#39;^(Mr|Mrs|Miss) \w+ \w+$&#39;);
  my $person_cmp = {
    Name =&gt; $name_re,
    Phone =&gt; re(&#39;^0d{6}$&#39;),
    # note no mention of Children here
  };

  $person_cmp-&gt;{Children} = each_array($person_cmp);
  $person_cmp-&gt;{Parents} = each_array($person_cmp);

  cmp_deeply($person, $person_cmp, &quot;person ok&quot;);</code></pre>

<p>So this will check that for each child <code>$child</code> in <code>$person-&gt;{Children}</code> that the <code>$child-&gt;{Parents}</code> matches <code>$person_cmp</code> however it is smart enough not to get caught in an infinite loop where it keeps bouncing between the same Parent and Child.</p>

<h1 id="TERMINOLOGY">TERMINOLOGY</h1>

<p><code>cmp_deeply($got, $expected, $name)</code> takes 3 arguments. <code>$got</code> is the structure that you are checking, you must not include any special comparisons in this structure or you will get a fatal error. <code>$expected</code> describes what Test::Deep will be looking for in $got. You can put special comparisons in $expected if you want to.</p>

<p>As Test::Deep descends through the 2 structures, it compares them one piece at a time, so at any point in the process, Test::Deep is thinking about 2 things - the current value from <code>$got</code> and the current value from <code>$expected</code>. In the documentation, I call them <code>$got_v</code> and <code>exp_v</code> respectively.</p>

<h1 id="COMPARISON-FUNCTIONS"><a id="COMPARISON"></a>COMPARISON FUNCTIONS</h1>

<h3 id="cmp_deeply">cmp_deeply</h3>

<pre><code>  my $ok = cmp_deeply($got, $expected, $name)</code></pre>

<p><code>$got</code> is the result to be checked. <code>$expected</code> is the structure against which <code>$got</code> will be check. <code>$name</code> is the test name.</p>

<p>This is the main comparison function, the others are just wrappers around this. <code>$got</code> and <code>$expected</code> are compared recursively. Each value in <code>$expected</code> defines what&#39;s expected at the corresponding location in <code>$got</code>. Simple scalars are compared with <code>eq</code>. References to structures like hashes and arrays are compared recursively.</p>

<p>Items in <code>$expected</code>, though, can also represent complex tests that check for numbers in a given range, hashes with at least a certain set of keys, a string matching a regex, or many other things.</p>

<p>See <a href="./Test::Deep.html#WHAT-ARE-SPECIAL-COMPARISONS">&quot;WHAT ARE SPECIAL COMPARISONS&quot;</a> for details.</p>

<h3 id="cmp_bag">cmp_bag</h3>

<pre><code>  my $ok = cmp_bag(\@got, \@bag, $name)</code></pre>

<p>Is shorthand for cmp_deeply(\@got, bag(@bag), $name)</p>

<p><i>n.b.</i>: Both arguments must be array refs. If they aren&#39;t an exception will be thrown.</p>

<h3 id="cmp_set">cmp_set</h3>

<pre><code>  my $ok = cmp_set(\@got, \@set, $name)</code></pre>

<p>Is shorthand for cmp_deeply(\@got, set(@set), $name)</p>

<h3 id="cmp_methods">cmp_methods</h3>

<pre><code>  my $ok = cmp_methods(\@got, \@methods, $name)</code></pre>

<p>Is shorthand for cmp_deeply(\@got, methods(@methods), $name)</p>

<h3 id="eq_deeply">eq_deeply</h3>

<pre><code>  my $ok = eq_deeply($got, $expected)</code></pre>

<p>This is the same as cmp_deeply() except it just returns true or false. It does not create diagnostics or talk to <a href="https://metacpan.org/pod/Test::Builder">Test::Builder</a>, but if you want to use it in a non-testing environment then you should import it through <a href="https://metacpan.org/pod/Test::Deep::NoTest">Test::Deep::NoTest</a>. For example</p>

<pre><code>  use Test::Deep::NoTest;
  print &quot;a equals b&quot; unless eq_deeply($a, $b);</code></pre>

<p>otherwise the <a href="https://metacpan.org/pod/Test::Builder">Test::Builder</a> framework will be loaded and testing messages will be output when your program ends.</p>

<h3 id="cmp_details">cmp_details</h3>

<pre><code>  ($ok, $stack) = cmp_details($got, $expected)</code></pre>

<p>This behaves much like eq_deeply, but it additionally allows you to produce diagnostics in case of failure by passing the value in <code>$stack</code> to <code>deep_diag</code>.</p>

<p>Do not make assumptions about the structure or content of <code>$stack</code> and do not use it if <code>$ok</code> contains a true value.</p>

<p>See <a href="./Test::Deep.html#USING-TEST::DEEP-WITH-TEST::BUILDER">&quot;USING TEST::DEEP WITH TEST::BUILDER&quot;</a> for example uses.</p>

<h1 id="SPECIAL-COMPARISONS-PROVIDED"><a id="SPECIAL"></a>SPECIAL COMPARISONS PROVIDED</h1>

<p>In the documentation below, <code>$got_v</code> is used to indicate any given value within the <code>$got</code> structure.</p>

<h3 id="ignore">ignore</h3>

<pre><code>  cmp_deeply( $got, ignore() );</code></pre>

<p>This makes Test::Deep skip tests on <code>$got_v</code>. No matter what value <code>$got_v</code> has, Test::Deep will think it&#39;s correct. This is useful if some part of the structure you are testing is very complicated and already tested elsewhere, or if it is unpredictable.</p>

<pre><code>  cmp_deeply(
    $got,
    {
      name    =&gt; &#39;John&#39;,
      random  =&gt; ignore(),
      address =&gt; [ &#39;5 A street&#39;, &#39;a town&#39;, &#39;a country&#39; ],
    }
  );</code></pre>

<p>is the equivalent of checking</p>

<pre><code>  $got-&gt;{name} eq &#39;John&#39;;
  exists $got-&gt;{random};
  cmp_deeply($got-&gt;{address}, [&#39;5 A street&#39;, &#39;a town&#39;, &#39;a country&#39;]);</code></pre>

<h3 id="methods">methods</h3>

<pre><code>  cmp_deeply( $got, methods(%hash) );</code></pre>

<p>%hash is a hash of method call =&gt; expected value pairs.</p>

<p>This lets you call methods on an object and check the result of each call. The methods will be called in the order supplied. If you want to pass arguments to the method you should wrap the method name and arguments in an array reference.</p>

<pre><code>  cmp_deeply(
    $obj,
    methods(name =&gt; &quot;John&quot;, [&quot;favourite&quot;, &quot;food&quot;] =&gt; &quot;taco&quot;)
  );</code></pre>

<p>is roughly the equivalent of checking that</p>

<pre><code>  $obj-&gt;name eq &quot;John&quot;
  $obj-&gt;favourite(&quot;food&quot;) eq &quot;taco&quot;</code></pre>

<p>The methods will be called in the order you supply them and will be called in scalar context. If you need to test methods called in list context then you should use <code>listmethods()</code>.</p>

<p><b>NOTE</b> Just as in a normal test script, you need to be careful if the methods you call have side effects like changing the object or other objects in the structure. Although the order of the methods is fixed, the order of some other tests is not so if <code>$expected</code> is</p>

<pre><code>  {
    manager =&gt; methods(@manager_methods),
    coder =&gt; methods(@coder_methods)
  }</code></pre>

<p>there is no way to know which if manager and coder will be tested first. If the methods you are testing depend on and alter global variables or if manager and coder are the same object then you may run into problems.</p>

<h3 id="listmethods">listmethods</h3>

<pre><code>  cmp_deeply( $got, listmethods(%hash) );</code></pre>

<p><code>%hash</code> is a hash of pairs mapping method names to expected return values.</p>

<p>This is almost identical to methods() except the methods are called in list context instead of scalar context. This means that the expected return values supplied must be in array references.</p>

<pre><code>  cmp_deeply(
    $obj,
    listmethods(
      name =&gt; [ &quot;John&quot; ],
      [&quot;favourites&quot;, &quot;food&quot;] =&gt; [&quot;Mapo tofu&quot;, &quot;Gongbao chicken&quot;]
    )
  );</code></pre>

<p>is the equivalent of checking that</p>

<pre><code>  cmp_deeply([$obj-&gt;name], [&quot;John&quot;]);
  cmp_deeply([$obj-&gt;favourites(&quot;food&quot;)], [&quot;Mapo tofu&quot;, &quot;Gongbao chicken&quot;]);</code></pre>

<p>The methods will be called in the order you supply them.</p>

<p><b>NOTE</b> The same caveats apply as for methods().</p>

<h3 id="shallow">shallow</h3>

<pre><code>  cmp_deeply( $got, shallow($thing) );</code></pre>

<p><code>$thing</code> is a ref.</p>

<p>This prevents Test::Deep from looking inside <code>$thing</code>. It allows you to check that <code>$got_v</code> and <code>$thing</code> are references to the same variable. So</p>

<pre><code>  my @a = @b = (1, 2, 3);
  cmp_deeply(\@a, \@b);</code></pre>

<p>will pass because <code>@a</code> and <code>@b</code> have the same elements however</p>

<pre><code>  cmp_deeply(\@a, shallow(\@b))</code></pre>

<p>will fail because although <code>\@a</code> and <code>\@b</code> both contain <code>1, 2, 3</code> they are references to different arrays.</p>

<h3 id="noclass">noclass</h3>

<pre><code>  cmp_deeply( $got, noclass($thing) );</code></pre>

<p><code>$thing</code> is a structure to be compared against.</p>

<p>This makes Test::Deep ignore the class of objects, so it just looks at the data they contain. Class checking will be turned off until Test::Deep is finished comparing <code>$got_v</code> against <code>$thing</code>. Once Test::Deep comes out of <code>$thing</code> it will go back to its previous setting for checking class.</p>

<p>This can be useful when you want to check that objects have been constructed correctly but you don&#39;t want to write lots of <code>bless</code>es. If <code>@people</code> is an array of Person objects then</p>

<pre><code>  cmp_deeply(\@people, [
    bless {name =&gt; &#39;John&#39;, phone =&gt; &#39;555-5555&#39;}, &quot;Person&quot;,
    bless {name =&gt; &#39;Anne&#39;, phone =&gt; &#39;444-4444&#39;}, &quot;Person&quot;,
  ]);</code></pre>

<p>can be replaced with</p>

<pre><code>  cmp_deeply(\@people, noclass([
    {name =&gt; &#39;John&#39;, phone =&gt; &#39;555-5555&#39;},
    {name =&gt; &#39;Anne&#39;, phone =&gt; &#39;444-4444&#39;}
  ]));</code></pre>

<p>However, this is testing so you should also check that the objects are blessed correctly. You could use a map to bless all those hashes or you could do a second test like</p>

<pre><code>  cmp_deeply(\@people, array_each(isa(&quot;Person&quot;));</code></pre>

<h3 id="useclass">useclass</h3>

<pre><code>  cmp_deeply( $got, useclass($thing) );</code></pre>

<p>This turns back on the class comparison while inside a <code>noclass()</code>.</p>

<pre><code>  cmp_deeply(
    $got,
    noclass(
      [
        useclass( $object )
      ]
    )
  )</code></pre>

<p>In this example the class of the array reference in <code>$got</code> is ignored but the class of <code>$object</code> is checked, as is the class of everything inside <code>$object</code>.</p>

<h3 id="re">re</h3>

<pre><code>  cmp_deeply( $got, re($regexp, $capture_data, $flags) );</code></pre>

<p><code>$regexp</code> is either a regular expression reference produced with <code>qr/.../</code> or a string which will be used to construct a regular expression.</p>

<p><code>$capture_data</code> is optional and is used to check the strings captured by an regex. This should can be an array ref or a Test::Deep comparator that works on array refs.</p>

<p><code>$flags</code> is an optional string which controls whether the regex runs as a global match. If <code>$flags</code> is &quot;g&quot; then the regex will run as <code>m/$regexp/g</code>.</p>

<p>Without <code>$capture_data</code>, this simply compares <code>$got_v</code> with the regular expression provided. So</p>

<pre><code>  cmp_deeply($got, [ re(&quot;ferg&quot;) ])</code></pre>

<p>is the equivalent of</p>

<pre><code>  $got-&gt;[0] =~ /ferg/</code></pre>

<p>With <code>$capture_data</code>,</p>

<pre><code>  cmp_deeply($got, [re($regex, $capture_data)])</code></pre>

<p>is the equivalent of</p>

<pre><code>  my @data = $got-&gt;[0] =~ /$regex/;
  cmp_deeply(\@data, $capture_data);</code></pre>

<p>So you can do something simple like</p>

<pre><code>  cmp_deeply($got, re(qr/(\d\d)(\w\w)/, [25, &quot;ab&quot; ]))</code></pre>

<p>to check that <code>(\d\d)</code> was 25 and <code>(\w\w)</code> was &quot;ab&quot; but you can also use Test::Deep objects to do more complex testing of the captured values</p>

<pre><code>  cmp_deeply(
    &quot;cat=2,dog=67,sheep=3,goat=2,dog=5&quot;,
    re(
      qr/(\D+)=\d+,?/,
      set(qw( cat sheep dog )),
      &quot;g&quot;
    ),
  );</code></pre>

<p>here, the regex will match the string and will capture the animal names and check that they match the specified set, in this case it will fail, complaining that &quot;goat&quot; is not in the set.</p>

<h3 id="all">all</h3>

<pre><code>  cmp_deeply( $got, all(@expecteds) );</code></pre>

<p><code>@expecteds</code> is an array of expected structures.</p>

<p>This allows you to compare data against multiple expected results and make sure each of them matches.</p>

<pre><code>  cmp_deeply($got, all(isa(&quot;Person&quot;), methods(name =&gt; &#39;John&#39;)))</code></pre>

<p>is equivalent to</p>

<pre><code>  $got-&gt;isa(&quot;Person&quot;)
  $got-&gt;name eq &#39;John&#39;</code></pre>

<p>If either test fails then the whole thing is considered a fail. This is a short-circuit test, the testing is stopped after the first failure, although in the future it may complete all tests so that diagnostics can be output for all failures. When reporting failure, the parts are counted from 1.</p>

<p>Thanks to the magic of overloading, you can write</p>

<pre><code>  any( re(&quot;^wi&quot;), all(isa(&quot;Person&quot;), methods(name =&gt; &#39;John&#39;)) )</code></pre>

<p>as</p>

<pre><code>   re(&quot;^wi&quot;) | isa(&quot;Person&quot;) &amp; methods(name =&gt; &#39;John&#39;)</code></pre>

<p>Note <b>single</b> <code>|</code> not double, as <code>||</code> cannot be overloaded. This will only work when there is a special comparison involved. If you write</p>

<pre><code>  &quot;john&quot; | &quot;anne&quot; | &quot;robert&quot;</code></pre>

<p>Perl will turn this into</p>

<pre><code>  &quot;{onort&quot;</code></pre>

<p>which is presumably not what you wanted. This is because perl ors them together as strings before Test::Deep gets a chance to do any overload tricks.</p>

<h3 id="any">any</h3>

<pre><code>  cmp_deeply( $got, any(@expecteds) );</code></pre>

<p><code>@expecteds</code> is an array of expected structures.</p>

<p>This can be used to compare data against multiple expected results and make sure that at least one of them matches. This is a short-circuit test so if a test passes then none of the tests after that will be attempted.</p>

<p>You can also use overloading with <code>|</code> similarly to all().</p>

<h3 id="Isa">Isa</h3>

<pre><code>  cmp_deeply( $got, Isa($class) );</code></pre>

<h3 id="isa">isa</h3>

<pre><code>  cmp_deeply( $got, isa($class) );</code></pre>

<p><code>$class</code> is a class name.</p>

<p>This uses <code>UNIVERSAL::isa()</code> to check that <code>$got_v</code> is blessed into the class <code>$class</code>.</p>

<p><b>NOTE:</b> <code>Isa()</code> does exactly as documented here, but <code>isa()</code> is slightly different. If <code>isa()</code> is called with 1 argument it falls through to <code>Isa()</code>. If <code>isa()</code> called with 2 arguments, it falls through to <code>UNIVERSAL::isa</code>. This is to prevent breakage when you import <code>isa()</code> into a package that is used as a class. Without this, anyone calling <code>Class-&gt;isa($other_class)</code> would get the wrong answer. This is a hack to patch over the fact that <code>isa</code> is exported by default.</p>

<h3 id="obj_isa">obj_isa</h3>

<pre><code>  cmp_deeply( $got, obj_isa($class) );</code></pre>

<p>This test accepts only objects that are instances of <code>$class</code> or a subclass. Unlike the <code>Isa</code> test, this test will never accept class names.</p>

<h3 id="array_each">array_each</h3>

<pre><code>  cmp_deeply( \@got, array_each($thing) );</code></pre>

<p><code>$thing</code> is a structure to be compared against.</p>

<p>&lt;$got_v&gt; must be an array reference. Each element of it will be compared to <code>$thing</code>. This is useful when you have an array of similar things, for example objects of a known type and you don&#39;t want to have to repeat the same test for each one.</p>

<pre><code>  my $common_tests = all(
     isa(&quot;MyFile&quot;),
     methods(
       handle =&gt; isa(&quot;IO::Handle&quot;)
       filename =&gt; re(&quot;^/home/ted/tmp&quot;),
    )
  );

  cmp_deeply($got, array_each($common_tests));</code></pre>

<p>is similar to</p>

<pre><code>  foreach my $got_v (@$got) {
    cmp_deeply($got_v, $common_tests)
  }</code></pre>

<p>Except it will not explode if <code>$got</code> is not an array reference. It will check that each of the objects in <code>@$got</code> is a MyFile and that each one gives the correct results for its methods.</p>

<p>You could go further, if for example there were 3 files and you knew the size of each one you could do this</p>

<pre><code>  cmp_deeply(
    $got,
    all(
      array_each($common_tests),
      [
        methods(size =&gt; 1000),
        methods(size =&gt; 200),
        methods(size =&gt; 20)
      ]
    )
  )
  cmp_deeply($got, array_each($structure));</code></pre>

<h3 id="hash_each">hash_each</h3>

<pre><code>  cmp_deeply( \%got, hash_each($thing) );</code></pre>

<p>This test behaves like <code>array_each</code> (see above) but tests that each hash value passes its tests.</p>

<h3 id="str">str</h3>

<pre><code>  cmp_deeply( $got, str($string) );</code></pre>

<p>$string is a string.</p>

<p>This will stringify <code>$got_v</code> and compare it to <code>$string</code> using <code>eq</code>, even if <code>$got_v</code> is a ref. It is useful for checking the stringified value of an overloaded reference.</p>

<h3 id="num">num</h3>

<pre><code>  cmp_deeply( $got, num($number, $tolerance) );</code></pre>

<p><code>$number</code> is a number.</p>

<p><code>$tolerance</code> is an optional number.</p>

<p>This will add 0 to <code>$got_v</code> and check if it&#39;s numerically equal to <code>$number</code>, even if <code>$got_v</code> is a ref. It is useful for checking the numerical value of an overloaded reference. If <code>$tolerance</code> is supplied then this will check that <code>$got_v</code> and <code>$exp_v</code> are less than <code>$tolerance</code> apart. This is useful when comparing floating point numbers as rounding errors can make it hard or impossible for <code>$got_v</code> to be exactly equal to <code>$exp_v</code>. When <code>$tolerance</code> is supplied, the test passes if <code>abs($got_v - $exp_v) &lt;= $tolerance</code>.</p>

<p><b>Note</b> in Perl, <code>&quot;12blah&quot; == 12</code> because Perl will be smart and convert &quot;12blah&quot; into 12. You may not want this. There was a strict mode but that is now gone. A &quot;looks like a number&quot; test will replace it soon. Until then you can usually just use the string() comparison to be more strict. This will work fine for almost all situations, however it will not work when &lt;$got_v&gt; is an overloaded value who&#39;s string and numerical values differ.</p>

<h3 id="bool,-true,-false"><a id="bool"></a><a id="bool--true--false"></a>bool, true, false</h3>

<pre><code>  cmp_deeply( $got, bool($value) );
  cmp_deeply( $got, true );
  cmp_deeply( $got, false );</code></pre>

<p><code>$value</code> is anything you like but it&#39;s probably best to use 0 or 1</p>

<p>This will check that <code>$got_v</code> and <code>$value</code> have the same truth value, that is they will give the same result when used in boolean context, like in an <code>if()</code> statement.</p>

<p><b>Note:</b> <code>true</code> and <code>false</code> are only imported by special request.</p>

<h3 id="code">code</h3>

<pre><code>  cmp_deeply( $got, code(\&amp;subref) );</code></pre>

<p><code>\&amp;subref</code> is a reference to a subroutine which will be passed a single argument, it then should return a true or false and possibly a string</p>

<p>This will pass <code>$got_v</code> to the subroutine which returns true or false to indicate a pass or fail. Fails can be accompanied by a diagnostic string which gives an explanation of why it&#39;s a fail.</p>

<pre><code>  sub check_name
  {
    my $name = shift;
    if ($boss-&gt;likes($name))
    {
      return 1;
    }
    else
    {
      return (0, &quot;the boss doesn&#39;t like your name&quot;);
    }
  }

  cmp_deeply(&quot;Brian&quot;, code(\&amp;check_name));</code></pre>

<h2 id="SET-COMPARISONS"><a id="SET"></a>SET COMPARISONS</h2>

<p>Set comparisons give special semantics to array comparisons:</p>

<ul>

<li><p>The order of items in a set is irrelevant</p>

</li>
<li><p>The presence of duplicate items in a set is ignored.</p>

</li>
</ul>

<p>As such, in any set comparison, the following arrays are equal:</p>

<pre><code>  [ 1, 2 ]
  [ 1, 1, 2 ]
  [ 1, 2, 1 ]
  [ 2, 1, 1 ]
  [ 1, 1, 2 ]</code></pre>

<p>All are interpreted by <code>set</code> semantics as if the set was only specified as:</p>

<pre><code>  [ 1, 2 ]</code></pre>

<p>All <code>set</code> functions return an object which can have additional items added to it:</p>

<pre><code>  my $set = set( 1, 2 );
  $set-&gt;add(1, 3, 1 );  # Set is now ( 1, 2, 3 )</code></pre>

<p>Special care must be taken when using special comparisons within sets. See <a href="./Test::Deep.html#SPECIAL-CARE-WITH-SPECIAL-COMPARISONS-IN-SETS-AND-BAGS">&quot;SPECIAL CARE WITH SPECIAL COMPARISONS IN SETS AND BAGS&quot;</a> for details.</p>

<h3 id="set">set</h3>

<pre><code>  cmp_deeply( \@got, set(@elements) );</code></pre>

<p>This does a set comparison, that is, it compares two arrays but ignores the order of the elements and it ignores duplicate elements, but ensures that all items in <code>@elements</code> will be in <code>$got</code> and all items in <code>$got</code> will be in <code>@elements</code>.</p>

<p>So the following tests will be passes, and will be equivalent:</p>

<pre><code>  cmp_deeply([1, 2, 2, 3], set(3, 2, 1, 1));
  cmp_deeply([1, 2, 3],    set(3, 2, 1));</code></pre>

<h3 id="supersetof">supersetof</h3>

<pre><code>  cmp_deeply( \@got, supersetof(@elements) );</code></pre>

<p>This function works much like <a href="./Test::Deep.html#set"><code>set</code></a>, and performs a set comparison of <code>$got_v</code> with the elements of <code>@elements</code>.</p>

<p><code>supersetof</code> is however slightly relaxed, such that <code>$got</code> may contain things not in <code>@elements</code>, but must at least contain all <code>@elements</code>.</p>

<p>These two statements are equivalent, and will be passes:</p>

<pre><code>  cmp_deeply([1,2,3,3,4,5], supersetof(2,2,3));
  cmp_deeply([1,2,3,4,5],   supersetof(2,3));</code></pre>

<p>But these will be failures:</p>

<pre><code>  cmp_deeply([1,2,3,4,5],   supersetof(2,3,6)); # 6 not in superset
  cmp_deeply([1],           supersetof(1,2));   # 2 not in superset</code></pre>

<h3 id="subsetof">subsetof</h3>

<pre><code>  cmp_deeply( \@got, subsetof(@elements) );</code></pre>

<p>This function works much like <a href="./Test::Deep.html#set"><code>set</code></a>, and performs a set comparison of <code>$got_v</code> with the elements of <code>@elements</code>.</p>

<p>This is the inverse of <code>supersetof</code>, which expects all unique elements found in <code>$got_v</code> must be in <code>@elements</code>.</p>

<pre><code>  cmp_deeply([1,2,4,5], subsetof(2,3,3)    ) # Fail: 1,4 &amp; 5 extra
  cmp_deeply([2,3,3],   subsetof(1,2,4,5)  ) # Fail: 3 extra
  cmp_deeply([2,3,3],   subsetof(1,2,4,5,3)) # Pass</code></pre>

<h3 id="none">none</h3>

<pre><code>  cmp_deeply( $got, none(@elements) );</code></pre>

<p>@elements is an array of elements, wherein no elements in <code>@elements</code> may be equal to <code>$got_v</code>.</p>

<h3 id="noneof">noneof</h3>

<pre><code>  cmp_deeply( \@got, noneof(@elements) );</code></pre>

<p>@elements is an array of elements, wherein no elements in <code>@elements</code> may be found in <code>$got_v</code>.</p>

<p>For example:</p>

<pre><code>  # Got has no 1, no 2, and no 3
  cmp_deeply( [1], noneof( 1, 2, 3 ) ); # fail
  cmp_deeply( [5], noneof( 1, 2, 3 ) ); # pass</code></pre>

<h2 id="BAG-COMPARISONS"><a id="BAG"></a>BAG COMPARISONS</h2>

<p>Bag comparisons give special semantics to array comparisons, that are similar to <a href="./Test::Deep.html#SET-COMPARISONS">set comparisons</a>, but slightly different.</p>

<ul>

<li><p>The order of items in a bag is irrelevant</p>

</li>
<li><p>The presence of duplicate items in a bag is <b>PRESERVED</b></p>

</li>
</ul>

<p>As such, in any bag comparison, the following arrays are equal:</p>

<pre><code>  [ 1, 1, 2 ]
  [ 1, 2, 1 ]
  [ 2, 1, 1 ]
  [ 1, 1, 2 ]</code></pre>

<p>However, they are <b>NOT</b> equal to any of the following:</p>

<pre><code>  [ 1, 2 ]
  [ 1, 2, 2 ]
  [ 1, 1, 1, 2 ]</code></pre>

<p>All <code>bag</code> functions return an object which can have additional items added to it:</p>

<pre><code>  my $bag = bag( 1, 2 );
  $bag-&gt;add(1, 3, 1 );  # Bag is now ( 1, 1, 1, 2, 3 )</code></pre>

<p>Special care must be taken when using special comparisons within bags. See <a href="./Test::Deep.html#SPECIAL-CARE-WITH-SPECIAL-COMPARISONS-IN-SETS-AND-BAGS">&quot;SPECIAL CARE WITH SPECIAL COMPARISONS IN SETS AND BAGS&quot;</a> for details.</p>

<h3 id="bag">bag</h3>

<pre><code>  cmp_deeply( \@got, bag(@elements) );</code></pre>

<p>This does an order-insensitive bag comparison between <code>$got</code> and <code>@elements</code>, ensuring that:</p>

<dl>

<dt id="each-item-in-@elements-is-found-in-$got"><a id="each"></a><a id="each-item-in--elements-is-found-in--got"></a>each item in <code>@elements</code> is found in <code>$got</code></dt>
<dd>

</dd>
<dt id="the-number-of-times-a-$expected_v-is-found-in-@elements-is-reflected-in-$got"><a id="the"></a><a id="the-number-of-times-a--expected_v-is-found-in--elements-is-reflected-in--got"></a>the number of times a <code>$expected_v</code> is found in <code>@elements</code> is reflected in <code>$got</code></dt>
<dd>

</dd>
<dt id="no-items-are-found-in-$got-other-than-those-in-@elements."><a id="no"></a><a id="no-items-are-found-in--got-other-than-those-in--elements"></a>no items are found in <code>$got</code> other than those in <code>@elements</code>.</dt>
<dd>

</dd>
</dl>

<p>As such, the following are passes, and are equivalent to each other:</p>

<pre><code>  cmp_deeply([1, 2, 2], bag(2, 2, 1))
  cmp_deeply([2, 1, 2], bag(2, 2, 1))
  cmp_deeply([2, 2, 1], bag(2, 2, 1))</code></pre>

<p>But the following are failures:</p>

<pre><code>  cmp_deeply([1, 2, 2],     bag(2, 2, 1, 1)) # Not enough 1&#39;s in Got
  cmp_deeply([1, 2, 2, 1],  bag(2, 2, 1)   ) # Too many   1&#39;s in Got</code></pre>

<h3 id="superbagof">superbagof</h3>

<pre><code>  cmp_deeply( \@got, superbagof( @elements ) );</code></pre>

<p>This function works much like <a href="./Test::Deep.html#bag"><code>bag</code></a>, and performs a bag comparison of <code>$got_v</code> with the elements of <code>@elements</code>.</p>

<p><code>superbagof</code> is however slightly relaxed, such that <code>$got</code> may contain things not in <code>@elements</code>, but must at least contain all <code>@elements</code>.</p>

<p>So:</p>

<pre><code>  # pass
  cmp_deeply( [1, 1, 2], superbagof( 1 )      );

  # fail: not enough 1&#39;s in superbag
  cmp_deeply( [1, 1, 2], superbagof( 1, 1, 1 ));</code></pre>

<h3 id="subbagof">subbagof</h3>

<pre><code>  cmp_deeply( \@got, subbagof(@elements) );</code></pre>

<p>This function works much like <a href="./Test::Deep.html#bag"><code>bag</code></a>, and performs a bag comparison of <code>$got_v</code> with the elements of <code>@elements</code>.</p>

<p>This is the inverse of <code>superbagof</code>, and expects all elements in <code>$got</code> to be in <code>@elements</code>, while allowing items to exist in <code>@elements</code> that are not in <code>$got</code></p>

<pre><code>  # pass
  cmp_deeply( [1],        subbagof( 1, 1, 2 ) );

  # fail: too many 1&#39;s in subbag
  cmp_deeply( [1, 1, 1],  subbagof( 1, 1, 2 ) );</code></pre>

<h2 id="HASH-COMPARISONS"><a id="HASH"></a>HASH COMPARISONS</h2>

<p>Typically, if you&#39;re doing simple hash comparisons,</p>

<pre><code>  cmp_deeply( \%got, \%expected )</code></pre>

<p>is sufficient. <code>cmp_deeply</code> will ensure <code>%got</code> and <code>%hash</code> have identical keys, and each key from either has the same corresponding value.</p>

<h3 id="superhashof">superhashof</h3>

<pre><code>  cmp_deeply( \%got, superhashof(\%hash) );</code></pre>

<p>This will check that the hash <code>%$got</code> is a &quot;super-hash&quot; of <code>%hash</code>. That is that all the key and value pairs in <code>%hash</code> appear in <code>%$got</code> but <code>%$got</code> can have extra ones also.</p>

<p>For example</p>

<pre><code>  cmp_deeply({a =&gt; 1, b =&gt; 2}, superhashof({a =&gt; 1}))</code></pre>

<p>will pass but</p>

<pre><code>  cmp_deeply({a =&gt; 1, b =&gt; 2}, superhashof({a =&gt; 1, c =&gt; 3}))</code></pre>

<p>will fail.</p>

<h3 id="subhashof">subhashof</h3>

<pre><code>  cmp_deeply( \%got, subhashof(\%hash) );</code></pre>

<p>This will check that the hash <code>%$got</code> is a &quot;sub-hash&quot; of <code>%hash</code>. That is that all the key and value pairs in <code>%$got</code> also appear in <code>%hash</code>.</p>

<p>For example</p>

<pre><code>  cmp_deeply({a =&gt; 1}, subhashof({a =&gt; 1, b =&gt; 2}))</code></pre>

<p>will pass but</p>

<pre><code>  cmp_deeply({a =&gt; 1, c =&gt; 3}, subhashof({a =&gt; 1, b =&gt; 2}))</code></pre>

<p>will fail.</p>

<h1 id="DIAGNOSTIC-FUNCTIONS"><a id="DIAGNOSTIC"></a>DIAGNOSTIC FUNCTIONS</h1>

<h3 id="deep_diag">deep_diag</h3>

<pre><code>  my $reason = deep_diag($stack);</code></pre>

<p><code>$stack</code> is a value returned by cmp_details. Do not call this function if cmp_details returned a true value for <code>$ok</code>.</p>

<p><code>deep_diag()</code> returns a human readable string describing how the comparison failed.</p>

<h1 id="ANOTHER-EXAMPLE"><a id="ANOTHER"></a>ANOTHER EXAMPLE</h1>

<p>You&#39;ve written a module to handle people and their film interests. Say you have a function that returns an array of people from a query, each person is a hash with 2 keys: Name and Age and the array is sorted by Name. You can do</p>

<pre><code>  cmp_deeply(
    $result,
    [
      {Name =&gt; &#39;Anne&#39;, Age =&gt; 26},
      {Name =&gt; &quot;Bill&quot;, Age =&gt; 47}
      {Name =&gt; &#39;John&#39;, Age =&gt; 25},
    ]
  );</code></pre>

<p>Soon after, your query function changes and all the results now have an ID field. Now your test is failing again because you left out ID from each of the hashes. The problem is that the IDs are generated by the database and you have no way of knowing what each person&#39;s ID is. With Test::Deep you can change your query to</p>

<pre><code>  cmp_deeply(
    $result,
    [
      {Name =&gt; &#39;John&#39;, Age =&gt; 25, ID =&gt; ignore()},
      {Name =&gt; &#39;Anne&#39;, Age =&gt; 26, ID =&gt; ignore()},
      {Name =&gt; &quot;Bill&quot;, Age =&gt; 47, ID =&gt; ignore()}
    ]
  );</code></pre>

<p>But your test still fails. Now, because you&#39;re using a database, you no longer know what order the people will appear in. You could add a sort into the database query but that could slow down your application. Instead you can get Test::Deep to ignore the order of the array by doing a bag comparison instead.</p>

<pre><code>  cmp_deeply(
    $result,
    bag(
      {Name =&gt; &#39;John&#39;, Age =&gt; 25, ID =&gt; ignore()},
      {Name =&gt; &#39;Anne&#39;, Age =&gt; 26, ID =&gt; ignore()},
      {Name =&gt; &quot;Bill&quot;, Age =&gt; 47, ID =&gt; ignore()}
    )
  );</code></pre>

<p>Finally person gets even more complicated and includes a new field called Movies, this is a list of movies that the person has seen recently, again these movies could also come back in any order so we need a bag inside our other bag comparison, giving us something like</p>

<pre><code>  cmp_deeply(
  $result,
    bag(
      {Name =&gt; &#39;John&#39;, Age =&gt; 25, ID =&gt; ignore(), Movies =&gt; bag(...)},
      {Name =&gt; &#39;Anne&#39;, Age =&gt; 26, ID =&gt; ignore(), Movies =&gt; bag(...)},
      {Name =&gt; &quot;Bill&quot;, Age =&gt; 47, ID =&gt; ignore(), Movies =&gt; bag(...)}
    )
  );</code></pre>

<h1 id="USING-TEST::DEEP-WITH-TEST::BUILDER"><a id="USING"></a>USING TEST::DEEP WITH TEST::BUILDER</h1>

<p>Combining <code>cmp_details</code> and <code>deep_diag</code> makes it possible to use Test::Deep in your own test classes.</p>

<p>In a <a href="https://metacpan.org/pod/Test::Builder">Test::Builder</a> subclass, create a test method in the following form:</p>

<pre><code>  sub behaves_ok {
    my $self = shift;
    my $expected = shift;
    my $test_name = shift;

    my $got = do_the_important_work_here();

    my ($ok, $stack) = cmp_details($got, $expected);
    unless ($Test-&gt;ok($ok, $test_name)) {
      my $diag = deep_diag($stack);
      $Test-&gt;diag($diag);
    }
  }</code></pre>

<p>As the subclass defines a test class, not tests themselves, make sure it uses <a href="https://metacpan.org/pod/Test::Deep::NoTest">Test::Deep::NoTest</a>, not <code>Test::Deep</code> itself.</p>

<h1 id="LIMITATIONS">LIMITATIONS</h1>

<p>Currently any CODE, GLOB or IO refs will be compared using shallow(), which means only their memory addresses are compared.</p>

<h1 id="BUGS">BUGS</h1>

<p>There is a bug in set and bag compare to do with competing SCs. It only occurs when you put certain special comparisons inside bag or set comparisons you don&#39;t need to worry about it. The full details are in the <code>bag()</code> docs. It will be fixed in an upcoming version.</p>

<h1 id="CAVEATS">CAVEATS</h1>

<h2 id="SPECIAL-CARE-WITH-SPECIAL-COMPARISONS-IN-SETS-AND-BAGS"><a id="SPECIAL1"></a>SPECIAL CARE WITH SPECIAL COMPARISONS IN SETS AND BAGS</h2>

<p>If you use certain special comparisons within a bag or set comparison there is a danger that a test will fail when it should have passed. It can only happen if two or more special comparisons in the bag are competing to match elements. Consider this comparison</p>

<pre><code>  cmp_deeply([&#39;furry&#39;, &#39;furball&#39;], bag(re(&quot;^fur&quot;), re(&quot;furb&quot;)))</code></pre>

<p>There are two things that could happen, hopefully <code>re(&quot;^fur&quot;)</code> is paired with &quot;furry&quot; and <code>re(&quot;^furb&quot;)</code> is paired with &quot;furb&quot; and everything is fine but it could happen that <code>re(&quot;^fur&quot;)</code> is paired with &quot;furball&quot; and then <code>re(&quot;^furb&quot;)</code> cannot find a match and so the test fails. Examples of other competing comparisons are <code>bag(1, 2, 2)</code> vs <code>set(1, 2)</code> and <code>methods(m1 =&gt; &quot;v1&quot;, m2 =&gt; &quot;v2&quot;)</code> vs <code>methods(m1 =&gt; &quot;v1&quot;)</code></p>

<p>This problem is could be solved by using a slower and more complicated algorithm for set and bag matching. Something for the future...</p>

<h1 id="WHAT-ARE-SPECIAL-COMPARISONS?"><a id="WHAT"></a><a id="WHAT-ARE-SPECIAL-COMPARISONS"></a>WHAT ARE SPECIAL COMPARISONS?</h1>

<p>A special comparison (SC) is simply an object that inherits from Test::Deep::Cmp. Whenever <code>$expected_v</code> is an SC then instead of checking <code>$got_v eq $expected_v</code>, we pass control over to the SC and let it do its thing.</p>

<p>Test::Deep exports lots of SC constructors, to make it easy for you to use them in your test scripts. For example is <code>re(&quot;hello&quot;)</code> is just a handy way of creating a Test::Deep::Regexp object that will match any string containing &quot;hello&quot;. So</p>

<pre><code>  cmp_deeply([ &#39;a&#39;, &#39;b&#39;, &#39;hello world&#39;], [&#39;a&#39;, &#39;b&#39;, re(&quot;^hello&quot;)]);</code></pre>

<p>will check <code>&#39;a&#39; eq &#39;a&#39;</code>, <code>&#39;b&#39; eq &#39;b&#39;</code> but when it comes to comparing <code>&#39;hello world&#39;</code> and <code>re(&quot;^hello&quot;)</code> it will see that $expected_v is an SC and so will pass control to the Test::Deep::Regexp class by do something like <code>$expected_v-&gt;descend($got_v)</code>. The <code>descend()</code> method should just return true or false.</p>

<p>This gives you enough to write your own SCs but I haven&#39;t documented how diagnostics works because it&#39;s about to get an overhaul (theoretically).</p>

<h1 id="EXPORTS">EXPORTS</h1>

<p>By default, Test::Deep will export everything in its <code>v0</code> tag, as if you had written:</p>

<pre><code>  use Test::Deep &#39;:v0&#39;;</code></pre>

<p>Those things are:</p>

<pre><code>  all any array array_each arrayelementsonly arraylength arraylengthonly bag
  blessed bool cmp_bag cmp_deeply cmp_methods cmp_set code eq_deeply hash
  hash_each hashkeys hashkeysonly ignore Isa isa listmethods methods noclass
  none noneof num obj_isa re reftype regexpmatches regexponly regexpref
  regexprefonly scalarrefonly scalref set shallow str subbagof subhashof
  subsetof superbagof superhashof supersetof useclass</code></pre>

<p>A slightly better set of exports is the <code>v1</code> set. It&#39;s all the same things, with the exception of <code>Isa</code> and <code>blessed</code>. If you want to import &quot;everything&quot;, you probably want to <code>use Test::Deep &#39;:V1&#39;;</code>.</p>

<p>There&#39;s another magic export group: <code>:preload</code>. If that is specified, all of the Test::Deep plugins will be loaded immediately instead of lazily.</p>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p><a href="https://metacpan.org/pod/Test::More">Test::More</a></p>

<h1 id="THANKS">THANKS</h1>

<p>Thanks to Michael G Schwern for Test::More&#39;s is_deeply function which inspired this library.</p>

<h1 id="AUTHORS">AUTHORS</h1>

<ul>

<li><p>Fergal Daly</p>

</li>
<li><p>Ricardo SIGNES &lt;cpan@semiotic.systems&gt;</p>

</li>
</ul>

<h1 id="CONTRIBUTORS">CONTRIBUTORS</h1>

<ul>

<li><p>Alexander Karelas &lt;karjala@karjala.org&gt;</p>

</li>
<li><p>Belden Lyman &lt;blyman@shutterstock.com&gt;</p>

</li>
<li><p>Daniel B&ouml;hmer &lt;dboehmer@cpan.org&gt;</p>

</li>
<li><p>David Steinbrunner &lt;dsteinbrunner@pobox.com&gt;</p>

</li>
<li><p>Denis Ibaev &lt;dionys@gmail.com&gt;</p>

</li>
<li><p>Ed Adjei &lt;edmund@cpan.org&gt;</p>

</li>
<li><p>Fabrice Gabolde &lt;fabrice.gabolde@gmail.com&gt;</p>

</li>
<li><p>Felipe Gasper &lt;felipe@felipegasper.com&gt;</p>

</li>
<li><p>Fergal Daly &lt;fergal@esatclear.ie&gt;</p>

</li>
<li><p>George Hartzell &lt;hartzell@alerce.com&gt;</p>

</li>
<li><p>Graham Knop &lt;haarg@haarg.org&gt;</p>

</li>
<li><p>Ivan Bessarabov &lt;ivan@bessarabov.ru&gt;</p>

</li>
<li><p>Jos&eacute; Joaqu&iacute;n Atria &lt;jjatria@cpan.org&gt;</p>

</li>
<li><p>Karen Etheridge &lt;ether@cpan.org&gt;</p>

</li>
<li><p>Kent Fredric &lt;kentfredric@gmail.com&gt;</p>

</li>
<li><p>Lance Wicks &lt;lancew@cpan.org&gt;</p>

</li>
<li><p>Matthew Horsfall &lt;wolfsage@gmail.com&gt;</p>

</li>
<li><p>Michael Hamlin &lt;myrrhlin@gmail.com&gt;</p>

</li>
<li><p>Mohammad S Anwar &lt;mohammad.anwar@yahoo.com&gt;</p>

</li>
<li><p>Peter Haworth &lt;peter.haworth@headforwards.com&gt;</p>

</li>
<li><p>Philip J. Ludlam &lt;p.ludlam@cv-library.co.uk&gt;</p>

</li>
<li><p>Ricardo Signes &lt;rjbs@semiotic.systems&gt;</p>

</li>
<li><p>Zoffix Znet &lt;cpan@zoffix.com&gt;</p>

</li>
</ul>

<h1 id="COPYRIGHT-AND-LICENSE"><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1>

<p>This software is copyright (c) 2003 by Fergal Daly.</p>

<p>This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Test::Deep, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Test::Deep</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Test::Deep</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Test::Deep.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
